package com.one.rope.mvp.web.common.dto.user.business;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.one.rope.mvp.basecore.util.StringUtils;
import com.one.rope.mvp.web.common.cache.GlobalCacheDataObject;
import com.one.rope.mvp.web.common.enums.WorkFormEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * <p>
 * 合伙人岗位列表项返回参数
 * <p>
 *
 * @author ： Weijian.Liu
 * @date ： 2020/3/17 23:39
 */
@Data
@ApiModel
public class PartnerListItemVO {

  @JsonIgnore
  @ApiModelProperty(value = "项目名称")
  private String projectName;

  @ApiModelProperty(value = "岗位id")
  private Long id;

  @ApiModelProperty(value = "岗位名称")
  @JsonProperty(value = "partner_name")
  private String partnerName;

  @ApiModelProperty(value = "省编码")
  @JsonIgnore
  private String provinceCode;

  @ApiModelProperty(value = "市编码")
  @JsonIgnore
  private String cityCode;

  @ApiModelProperty(value = "所在城市")
  @JsonProperty("area_name")
  private String areaName;

  @ApiModelProperty(value = "工作形态(1：全职 2：兼职 3：外包)")
  @JsonIgnore
  private Integer workForm;

  @ApiModelProperty(value = "工作形态")
  @JsonProperty("work_form_str")
  private String workFormStr;

  public String getAreaName() {
    String provinceName = "";
    String cityName = "";
    if (!StringUtils.isNullOrEmpty(provinceCode)) {
      provinceName = GlobalCacheDataObject.getArea(provinceCode).getAreaName();
    }
    if (!StringUtils.isNullOrEmpty(cityCode)) {
      cityName = GlobalCacheDataObject.getArea(cityCode).getAreaName();
    }
    return provinceName + cityName;
  }

  public String getWorkFormStr() {
    if (null != workForm) {
      return WorkFormEnum.getName(workForm);
    }
    return "";
  }
}
